<!-- src/views/Login.vue -->
<template>
  <div>
    <h1>登录</h1>
    <el-text class="mx-1" size="large"
      >账号随便填 账号admin 有用户列表权限
    </el-text>
    <p>
      <el-input
        v-model="input"
        style="width: 240px"
        placeholder="随便填 账号"
        clearable
      />
    </p>
    <el-button type="primary" round @click="confirmLogin">登录</el-button>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { ElMessage } from "element-plus";
import { useRouter} from 'vue-router';
const router = useRouter();
const input = ref("");
const confirmLogin = () => {
  if (!input.value.trim()) {
    return ElMessage.error("请输入账号");
  }
  localStorage.setItem("token", input.value);
  ElMessage.success("登录成功");
  setTimeout(() => {
    router.push('/about')
  }, 500);
};
</script>

<style scoped></style>
